Skip to content

Conversation

@cepawiel
Copy link

Adds support for receiving the return code passed to the exit() syscall that was added to KOS in KallistiOS/KallistiOS@596f2bc. The value will be passed back over the serial connection to the host program which will use it as its return code when exiting.

I also changed some other exit codes to help determine when a failure has actually occurred in order to avoid false positives when using this change to detect passing or failing of software on the target.

@gyrovorbis
Copy link
Member

Thank you, thank you, THANK YOU!!!!

This was the last major missing piece in writing more testable, more easily automatable examples and test apps. This is what I've always wanted and needed for CI, and hopefully we can now go back and do a better job error checking in some of the examples and return error status codes upon failure, which can all become automated. :)

@gyrovorbis gyrovorbis added the enhancement New feature or request label May 20, 2023
@QuzarDC
Copy link
Member

QuzarDC commented May 20, 2023

Two things:

  1. It would, perhaps, be valuable to distinguish between 'exit code because someone scripted dc-tool wrong' (all the 'invalid commandline option' stuff) and 'exit code from the DC'. Maybe even something like assign one byte as different host error codes and leave the other 3 for target?
  2. This would likely have to be a second PR, but I don't know the code enough. It seems like it should also be possible to integrate the exception handler into this :)

Copy link
Member

@ljsebald ljsebald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to make sure that this change doesn't break when used with an older dcload-serial cd, it should really use a new command byte for the communication between the two parts. Please assign a new command code (it looks like 22 is the next free one) to the new exit syscall that has an argument, and update the code accordingly, while retaining the old behavior for command 0.

The target need not support sending code 0 after these changes, but keeping it in the host code will ensure that older dcload-serial discs do not break with a new dc-tool.

@ljsebald ljsebald self-assigned this Jun 6, 2023
cepawiel and others added 4 commits December 11, 2025 23:34
The return code passed to exit() on the target will be
transfered to the host and used as the exit code for the
host application.
Sometimes the tool would return a success code when an error
had occured. This change makes it so that invalid flags and other
errors return -1 to indicate failure.
Leave command 0 as the legacy exit for legacy dcload-serial discs, but
use command 22 for newer dcload-serial discs supporting return codes
As the new return code feature has been introduced altering the behavior
of the dcload-serial disc, we update the version number
@darcagn
Copy link
Contributor

darcagn commented Dec 12, 2025

  • Rebased on top of latest changes
  • Addressed feedback by restoring command code 0 to its previous use and assigned command code 22 to the new exit with return code function
  • Updated version to 1.0.7 to reflect the new functionality on the disc

@darcagn darcagn requested review from QuzarDC and ljsebald December 12, 2025 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants